package com.qf.util;

import com.qf.bean.Task;
import com.qf.dao.UsersDao;
import com.qf.dao.impl.UsersDaoImpl;
import org.quartz.*;

import java.util.Date;
import java.util.List;

/**
 * 2019/11/29
 * Administrator
 * quartz1129
 * 面向对象面向君  不负代码不负卿
 */
public class UserJob implements Job {
    //任务的内容
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        UsersDao usersDao = new UsersDaoImpl();
        //先得到jobDetail
        JobDetail jobDetail = jobExecutionContext.getJobDetail();
        JobDataMap dataMap = jobDetail.getJobDataMap();
        List<Task> taskList = usersDao.findTaskByName((String) dataMap.get("username"));
        for (Task task : taskList) {
            System.out.println("王五的任务时:"+task.getTaskContent()+",date="+new Date());
        }
    }
}
